package practice.Mathfactory;

import practice.dao.*;

/**
 * @author:雷淑娥
 * @Date:2024/12/9 10:23
 * version:1.0
 */
public class Simplefactory implements AbstractFactory {
    @Override
    public Computed getInstance(String type) {
        switch (type) {
            case "+":
                return new AddDaoImpl().getInstance(type);
            case "-":
                return new JianDaoImpl().getInstance(type);
            case "*":
                return new ChengDaoImpl().getInstance(type);
            case "/":
                return new ChuDaoImpl().getInstance(type);
            default:
                throw new RuntimeException("无效的数据库类型：" + type);
        }
    }
}
